﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Usermanagment.DBConnection;
using ConnectionControl;


namespace pokerServer.GameManagment.HumanFactor
{
	class AbsPlayerSpectator
	{
		protected String name;
		protected ClientConnection cc;
		protected int chips;
		protected DBConnect dbc;

		public String Name
		{
			get
			{
				return this.name;
			}

			set
			{
				this.name = this.cc.conName;
			}
		}

		public void sendMsg(String msg)
		{
			this.cc.SendMsg(msg);
		}

		protected void getReady()
		{
			dbc = new DBConnect();
		}

		protected int Chips
		{
			set
			{
				dbc.OpenConnection();
				new DBUpdate(dbc).updateChips(this.name, value);
				dbc.closeConnection();
			}
			get
			{
				dbc.OpenConnection();
				int val = 0;
				val = new DBDatafetch(dbc).getChips(this.name);				
				dbc.closeConnection();
				return val;
			}

		}



	}
}
